﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.WaterPurchase;

namespace University.Workshop.Presentation.WaterPurchase
{
    /// <summary>
    /// Interaction logic for PageReadView.xaml
    /// </summary>
    public partial class PageReadView : Page, IReadPrincipalView
    {
        PresenterReadWaterPurchase pReadWaterPurchaseView;

        public PageReadView(Model.WaterPurchase waterPurchase)
        {
            InitializeComponent();
            this.pReadWaterPurchaseView = new PresenterReadWaterPurchase(this, waterPurchase);
        }


        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            frmContent.Navigate(new PageFirstStepReadWaterPurchase(pReadWaterPurchaseView));
            pReadWaterPurchaseView.FirstTime();
        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {
            pReadWaterPurchaseView.GoStepOne();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pReadWaterPurchaseView.GoStepTwo();
        }

        #region IReadPrincipalView Members

        public void CallSecondPage()
        {
            PageSecondStepReadWaterPurchase pp = new PageSecondStepReadWaterPurchase(pReadWaterPurchaseView);
            ReadBasic = pp;
            frmContent.NavigationService.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        public void CallFirstPage()
        {
            PageFirstStepReadWaterPurchase pp = new PageFirstStepReadWaterPurchase(pReadWaterPurchaseView);
            ReadBasic = pp;
            frmContent.NavigationService.Navigate(pp);
        }

        public IReadBasicWaterPurchase ReadBasic
        {
            get;
            set;
        }

        #endregion

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            pReadWaterPurchaseView.GoNextPage();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pReadWaterPurchaseView.GoBackPage();
        }
    }
}
